import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Query,
} from '@nestjs/common';
import { WorksTagService } from './works-tag.service';
import { CreateWorksTagDto } from './dto/create-works-tag.dto';
import { UpdateWorksTagDto } from './dto/update-works-tag.dto';
import { ApiOperation, ApiTags } from '@nestjs/swagger';

@ApiTags('作品标签')
@Controller('worksTag')
export class WorksTagController {
  constructor(private readonly worksTagService: WorksTagService) {}

  @ApiOperation({ summary: '创建标签' })
  @Post()
  create(@Body() body: CreateWorksTagDto) {
    return this.worksTagService.create(body.name);
  }

  @ApiOperation({ summary: '获取全部分类列表' })
  @Get()
  async findAll(
    @Query() query,
    @Query('pageSize') pageSize: number,
    @Query('pageNum') pageNum: number,
  ) {
    return await this.worksTagService.findAll(query);
  }

  // @Delete(':id')
  // remove(@Param('id') id: string) {
  //   return this.worksTagService.remove(+id);
  // }
}
